package core.proto.annotation;

import core.proto.Util;
import core.proto.timeline.AnnotationInterval;

public class TimelineAnnotationUI extends AnnotationUI {

	private AnnotationInterval interval;
	
	public TimelineAnnotationUI (AnnotationModel model) throws CannotAddAnnotationException {
		super(model);
	}
	
	public void setAnnotationInterval (AnnotationInterval i) {
		this.interval = i;
	}
	
	protected void doFocusLostModelViewUpdates () {
		frame.setVisible(false);
		parent.repaint();
	}
	
	public void removeFromPane(){
		super.removeFromPane();
		parent.repaint();
	}
	
	@Override
	public boolean externalSetText (String text) {
		boolean remove = super.externalSetText(text);
		
		if (remove && interval != null) {
			interval.row.remInterval(interval);
		}
		parent.repaint();
		return remove;
	}
}
